package io.sdph.documents.model;

import io.sdph.products.model.Product;
import io.sdph.userprofile.model.User;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * Bean reprezentujący fakturę.
 *
 * @author Konrad Szewczyk
 * @since 0.0.1
 */
public class Invoice {

    // Numer faktury
    private String number;

    // Płatnik faktury
    private User buyer;

    // Typ faktury
    private InvoiceType type;

    // Wybrany sposób płatności
    private PaymentMethod paymentMethod;

    // Kwota do zapłaty (netto)
    private double price;

    // Lista produktów i ich ilości
    private Map<Product, Long> products;

    // Data wystawienia faktury
    private Date creationDate;

    // Data sprzedaży
    private Date sellDate;

    // Termin zapłaty faktur
    private Date deadlineDate;

    //Konstruktor klasy.
    public Invoice(String number) {
        this.number = number;
    }

    public String getNumber() {
        return number;
    }

    public User getBuyer() {
        return buyer;
    }

    public void setBuyer(User buyer) {
        this.buyer = buyer;
    }

    public InvoiceType getType() {
        return type;
    }

    public void setType(InvoiceType type) {
        this.type = type;
    }

    public PaymentMethod getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(PaymentMethod paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public Map<Product, Long> getProducts() {
        if (products == null) {
            products = new HashMap<Product, Long>();
        }
        return products;
    }

    public void setProducts(Map<Product, Long> products) {
        this.products = products;
    }

    public Date getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    public Date getSellDate() {
        return sellDate;
    }

    public void setSellDate(Date sellDate) {
        this.sellDate = sellDate;
    }

    public Date getDeadlineDate() {
        return deadlineDate;
    }

    public void setDeadlineDate(Date deadlineDate) {
        this.deadlineDate = deadlineDate;
    }
}
